#ifndef SYNC_FILE_H_
#define SYNC_FILE_H_

#include <boost/filesystem/path.hpp>
#include <boost/shared_ptr.hpp>
#include "interfaces/ScanCompletedInterface.h"

using namespace std;

class Sync_File
{
public:
    typedef enum _SyncStatus
    {
        UNDEFINED = 0,
        READY_TO_RECEIVE = 1,
        READY_TO_SEND = 2,
        RECEIVING = 3,
        SENDING = 4,
        IN_SYNC = 5
        // NOTE: if you're changing this, change also the strings (in the cpp)!
    } SyncStatus;
    
    static const string SyncStatus_Strings[];

    Sync_File(boost::filesystem::path common_path);
    virtual ~Sync_File();

    virtual void scan(boost::shared_ptr<ScanCompletedInterface> listener) = 0;  // scan file/directory -> make transparent
    boost::filesystem::path get_base_path() const;
    boost::filesystem::path get_common_path() const;
    boost::filesystem::path get_whole_path() const;
    bool is_transparent() const;
    void set_transparent(bool transparent);
    bool exists_locally() const;
    void set_exist_locally(bool existLocally);
    SyncStatus get_status() const;
    string get_status_as_string() const;
    void set_status(SyncStatus status);
    void set_status(uint8_t status);
    uint64_t get_estimatedsize() const;
    void set_estimatedsize(uint64_t estimatedSize);
    void set_base_path(boost::filesystem::path basePath);
    void set_common_path(boost::filesystem::path commonPath);


protected:
    boost::filesystem::path base_path;
    boost::filesystem::path common_path;
    SyncStatus status;
    bool transparent; // file is analyzed. you can "see through" it, e.g. if it's a directory, you can see subdirectories etc.
    bool exist_locally;
    uint64_t estimated_size;

    bool scanning;
    boost::shared_ptr<ScanCompletedInterface> scan_listener;
};

typedef boost::shared_ptr<Sync_File> SyncFilePtr;

#endif /* SYNC_FILE_H_ */
